package view;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

import model.ClassA;
import model.ClassB;
import model.ClassC;

@ManagedBean(name = "master")
@ViewScoped
public class Stack {
	
	private List<ClassA> classesA;

	@PostConstruct
	public void init() {
	    classesA = new ArrayList<ClassA>();
	    ClassA a1 = new ClassA("a1");
	    ClassA a2 = new ClassA("a2");
	    classesA.add(a1);
	    classesA.add(a2);

	    ClassB b11 = new ClassB("b11");
	    ClassB b12 = new ClassB("b12");
	    ClassB b21 = new ClassB("b21");

	    a1.addClassB(b11);
	    a1.addClassB(b12);
	    a2.addClassB(b21);

	    ClassC c111 = new ClassC("a", "b", "c", "d");
	    ClassC c112 = new ClassC("d", "e", "f", "g");
	    ClassC c121 = new ClassC("g", "h", "i", "j");
	    ClassC c211 = new ClassC("k", "l", "m", "n");
	    ClassC c212 = new ClassC("o", "p", null, null);

	    b11.addClassC(c111);
	    b11.addClassC(c112);
	    b12.addClassC(c121);
	    b21.addClassC(c211);
	    b21.addClassC(c212);
	}

	public List<ClassA> getClassesA() {
	    return classesA;
	}

	public void setClassesA(List<ClassA> classesA) {
	    this.classesA = classesA;
	}

}
